using System;
using System.Linq;
using System.Linq.Expressions;

namespace Budget.Core.Specifications.Base
{
    public abstract class Specification<T> : ISpecification<T>
    {
        protected abstract Expression<Func<T, bool>> Predicate { get; }

        public virtual IQueryable<T> SatisfyFrom(IQueryable<T> candidates)
        {
            return candidates.Where(Predicate).AsQueryable();
        }
    }
}